#include "camera.h"

camera::camera()
{
	m_view.identity();

	m_pos = vector3(0.0f,0.0f,0.0f);
}

camera::~camera()
{

}

void camera::move_x(float _dx)
{
	m_pos += vector3(_dx,0.0f,0.0f);
	_update_view();
}

void camera::move_y(float _dy)
{
	m_pos += vector3(0.0f,_dy,0.0f);
	_update_view();
}

void camera::move_z(float _dz)
{
	m_pos += vector3(0.0f,0.0f,_dz);
	_update_view();
}

void camera::_update_view()
{
	matrix4 pos,rot_x,rot_y,rot_z;
	pos.translate(m_pos);
	rot_x.rotate_x(0);
	rot_y.rotate_y(0);
	rot_z.rotate_z(0);
	m_view = pos.inverse()*rot_x*rot_y*rot_z;
}

matrix4& camera::get_view()
{
	return m_view;
}

vector3& camera::get_pos()
{
	return m_pos;
}